{"nbformat":4,"nbformat_minor":0,"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.3"},"colab":{"name":"DSNet.ipynb","provenance":[],"collapsed_sections":[]}},"cells":[{"cell_type":"markdown","metadata":{"id":"26MhA1POPkw0","colab_type":"text"},"source":["# DSNet:  Automatic Dermoscopic Skin Lesion Segmentation\n","\n","\n","* Through  this  study,  we  present  a  new  and  automatic  semantic  segmentation  network for robust skin lesion segmentation named Dermoscopic Skin Network (DSNet).\n","\n","* In order to reduce the number of parameters to make the network lightweight, we used a depth-wise separable convolution in lieu of standard convolution to project the learnt discriminating features onto the pixel space at different stages of the encoder.\n","\n","* For any query: \n","        ** Md. Kamrul Hasan \n","        ** M.Sc. in Medical Imaging and Applications (MAIA)\n","        ** Erasmus Scholar [2017-2019] \n","        ** Contact: kamruleeekuet@gmail.com"]},{"cell_type":"markdown","metadata":{"id":"Pv8J8rFPPkw2","colab_type":"text"},"source":["## Import all the python Packages "]},{"cell_type":"code","metadata":{"id":"-Ot2ezA6Pkw3","colab_type":"code","outputId":"8d723d06-3d01-40c5-8b00-4a92c88d47a2","colab":{}},"source":["#------------------------------Keras Packages----------------------------------- \n","from keras.models import *\n","from keras.layers import *\n","from keras.optimizers import *\n","from keras.callbacks import *\n","from keras.losses import *\n","from keras import backend as keras\n","from keras.applications.vgg16 import VGG16, preprocess_input\n","from keras.applications.densenet import DenseNet201, DenseNet121\n","from keras.utils import plot_model\n","from keras.preprocessing.image import ImageDataGenerator\n","\n","\n","#------------------------------Others python Packages---------------------------\n","import numpy as np # High-level mathematical functions for n-dimensional arrays \n","import os   \n","import cv2\n","import skimage.io as io\n","import skimage.transform as trans\n","import numpy as np\n","import glob\n","from PIL import Image\n","import skimage\n","from keras.initializers import Constant\n","from matplotlib import pyplot as plt\n","%matplotlib inline\n","from skimage.morphology import disk\n","from sklearn.metrics import confusion_matrix\n","from skimage.measure import label, regionprops\n","from sklearn.metrics import roc_curve, auc\n","from sklearn.metrics import jaccard_similarity_score"],"execution_count":0,"outputs":[{"output_type":"stream","text":["C:\\Users\\kamru\\Anaconda3\\lib\\site-packages\\h5py\\__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n","  from ._conv import register_converters as _register_converters\n","Using TensorFlow backend.\n"],"name":"stderr"}]},{"cell_type":"markdown","metadata":{"id":"Qvwfz5aXPkw8","colab_type":"text"},"source":["## Designing of Proposed DSNet"]},{"cell_type":"code","metadata":{"id":"gvQai2xaPkw9","colab_type":"code","colab":{}},"source":["def DSNet(nClasses, input_height, input_width):\n","\n","    #------------------------------Define Input Shape----------------------------------\n","    \n","    img_input = Input(shape=(input_height, input_width, 3)) # defining the Input shape \n","    \n","    #Load DenseNet121 from keras. This model is initialized with the ImageNet. \n","    #This part is responsible for the feature extraction which is so called convolution\n","    # part of the semantic segmentation (Encoder). \n","    \n","    Encoder_Dense = DenseNet121( weights = 'imagenet',\n","\t\t\t\t\t\tinclude_top = False,\n","\t\t\t\t\t\tinput_tensor = img_input) \n","\n","    Encoder = SeparableConv2D(filters = 1024,\n","\t\t\t\t\tkernel_size = (3, 3),\n","\t\t\t\t\tactivation = 'relu',\n","\t\t\t\t\tkernel_initializer='he_normal',\n","\t\t\t\t\tpadding=\"same\")(Encoder_Dense.output)\n","    Encoder = BatchNormalization()(Encoder)\n","\n","    \n","    # Decoding the encoded features to reconstruct the original input shape Image.\n","\n","    Decoder = UpSampling2D(size = (2, 2))(Encoder)\n","    Decoder = concatenate([Encoder_Dense.get_layer(name=\"pool3_pool\").output, Decoder], axis=-1)\n","    Decoder = SeparableConv2D(filters = 1024,\n","\t\t\t\t\t\tkernel_size = (3, 3),\n","\t\t\t\t\t\tactivation = 'relu',\n","\t\t\t\t\t\tkernel_initializer='he_normal',\n","\t\t\t\t\t\tpadding = \"same\")(Decoder)\n","    Decoder = BatchNormalization()(Decoder)\n","    \n","    Decoder = UpSampling2D(size = (2, 2))(Decoder)\n","    Decoder = concatenate([Encoder_Dense.get_layer(name=\"pool2_pool\").output, Decoder], axis=-1)\n","    Decoder = SeparableConv2D(filters = 512,\n","\t\t\t\t\t\tkernel_size = (3, 3),\n","\t\t\t\t\t\tactivation = 'relu',\n","\t\t\t\t\t\tkernel_initializer='he_normal',\n","\t\t\t\t\t\tpadding = \"same\")(Decoder)\n","    Decoder = BatchNormalization()(Decoder)\n","\n","    Decoder = UpSampling2D(size = (2, 2))(Decoder)\n","    Decoder = concatenate([Encoder_Dense.get_layer(name=\"pool1\").output, Decoder], axis=-1)\n","    Decoder = SeparableConv2D(filters = 256,\n","\t\t\t\t\t\tkernel_size = (3, 3),\n","\t\t\t\t\t\tactivation = 'relu',\n","\t\t\t\t\t\tkernel_initializer='he_normal',\n","\t\t\t\t\t\tpadding = \"same\")(Decoder)\n","    Decoder = BatchNormalization()(Decoder)\n","\n","    Decoder = UpSampling2D( size = (2, 2))(Decoder)\n","    Decoder = concatenate([Encoder_Dense.get_layer(name=\"conv1/bn\").output, Decoder], axis=-1)\n","    Decoder = SeparableConv2D(filters = 128,\n","\t\t\t\t\t\tkernel_size = (3, 3),\n","\t\t\t\t\t\tactivation = 'relu',\n","\t\t\t\t\t\tkernel_initializer='he_normal',\n","\t\t\t\t\t\tpadding = \"same\")(Decoder)\n","    Decoder = BatchNormalization()(Decoder)\n","\n","    Decoder = UpSampling2D(size = (2, 2))(Decoder)    \n","    Decoder = SeparableConv2D(filters = 64,\n","\t\t\t\t\t\tkernel_size = (3, 3),\n","\t\t\t\t\t\tactivation = 'relu',\n","\t\t\t\t\t\tkernel_initializer='he_normal',\n","\t\t\t\t\t\tpadding = \"same\")(Decoder)\n","    Decoder = BatchNormalization()(Decoder)\n","\n","    Decoder = SeparableConv2D(filters = nClasses,\n","\t\t\t\t\t\tkernel_size = (1, 1),\n","\t\t\t\t\t\tactivation = 'relu',\n","\t\t\t\t\t\tkernel_initializer='he_normal',\n","\t\t\t\t\t\tpadding = \"same\")(Decoder)\n","    Decoder = BatchNormalization()(Decoder)\n","    \n","\n","    Predicted_Mask = Conv2D(filters = 1,\n","\t\t\t\t\t\t\t\t\tkernel_size = 1,\n","\t\t\t\t\t\t\t\t\tactivation = 'sigmoid')(Decoder)\n","    \n","    \n","    DSNet_model = Model(input = img_input, output = Predicted_Mask)\n","\n","    return DSNet_model"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"t4tHE2mgPkxA","colab_type":"text"},"source":["## Data Pre-processing "]},{"cell_type":"code","metadata":{"id":"yIPFj2btPkxB","colab_type":"code","colab":{}},"source":["def DataPreProcessing(img, mask):\n","    img = preprocess_input(img) # Data standardization meaning 0 mean and unit variance.\n","    img = img/img.max()         # Data Normalization\n","    mask = mask/mask.max()      # Mask Normalization\n","    return (img, mask)          # Return Tuple of Original image along with GT image. "],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"K_xr-b9UPkxE","colab_type":"text"},"source":["## Function for Train generator "]},{"cell_type":"code","metadata":{"id":"ojIqKID9PkxE","colab_type":"code","colab":{}},"source":["def trainGenerator(batch_size,\n","                   train_path,\n","                   image_folder,\n","                   mask_folder,\n","                   aug_dict,\n","                   image_color_mode = \"rgb\",\n","                   mask_color_mode = \"grayscale\",\n","                   image_save_prefix  = \"image\",\n","                   mask_save_prefix  = \"mask\",\n","                   save_to_dir = None,\n","                   target_size = (192,256),\n","                   seed = 1):\n","    \n","    image_datagen = ImageDataGenerator(**aug_dict)\n","    mask_datagen = ImageDataGenerator(**aug_dict)\n","    \n","    image_generator = image_datagen.flow_from_directory(\n","        train_path,\n","        classes = [image_folder],\n","        class_mode = None,\n","        color_mode = 'rgb',\n","        target_size = target_size,\n","        batch_size = batch_size,\n","#         save_to_dir = save_to_dir,\n","#         save_prefix  = image_save_prefix,\n","        seed = seed)\n","\n","    \n","    mask_generator = mask_datagen.flow_from_directory(\n","        train_path,\n","        classes = [mask_folder],\n","        class_mode = None,\n","        color_mode = 'grayscale',\n","        target_size = target_size,\n","        batch_size = batch_size,\n","#         save_to_dir = save_to_dir,\n","#         save_prefix  = mask_save_prefix,\n","        seed = seed)\n","\n","    \n","    train_generator = zip(image_generator, mask_generator)\n","    \n","    for (img,mask) in train_generator:\n","        img,mask = DataPreProcessing(img,mask)\n","        yield (img,mask)"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"c2WcrkluPkxH","colab_type":"text"},"source":["## Function for Test and Validation generator "]},{"cell_type":"code","metadata":{"id":"ji2yxioePkxI","colab_type":"code","colab":{}},"source":["def ValGenerator(batch_size,\n","                 val_path,\n","                 image_folder,\n","                 mask_folder,\n","                 target_size = (192,256),\n","                 seed = 1):\n","    \n","    image_datagen = ImageDataGenerator()\n","    mask_datagen = ImageDataGenerator()\n","    \n","    image_generator = image_datagen.flow_from_directory(\n","        val_path,\n","        classes = [image_folder],\n","        class_mode = None,\n","        color_mode = 'rgb',\n","        target_size = target_size,\n","        batch_size = batch_size,\n","        seed = seed)\n","\n","    \n","    mask_generator = mask_datagen.flow_from_directory(\n","        val_path,\n","        classes = [mask_folder],\n","        class_mode = None,\n","        color_mode = 'grayscale',\n","        target_size = target_size,\n","        batch_size = batch_size,\n","        seed = seed)\n","\n","    \n","    val_generator = zip(image_generator, mask_generator)\n","    \n","    for (img,mask) in val_generator:\n","        img,mask = DataPreProcessing(img,mask)\n","        yield (img,mask)"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"-ua6ca01PkxL","colab_type":"text"},"source":["## Function for Loss"]},{"cell_type":"code","metadata":{"id":"cMEHH8qfPkxM","colab_type":"code","colab":{}},"source":["def dice_coef(y_true, y_pred):\n","    y_true_f = K.flatten(y_true)\n","    y_pred_f = K.flatten(y_pred)\n","    intersection = K.sum(y_true_f * y_pred_f)\n","    return (2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) + smooth)\n","\n","def dice_coef_loss(y_true, y_pred):\n","    return 1-dice_coef(y_true, y_pred)\n","\n","def Jaccard_coef(y_true, y_pred):\n","    y_true_f = K.flatten(y_true)\n","    y_pred_f = K.flatten(y_pred)\n","    intersection = K.sum(y_true_f * y_pred_f)\n","    return (intersection ) / (K.sum(y_true_f) + K.sum(y_pred_f) - intersection)\n","\n","def Jaccard_coef_loss(y_true, y_pred):\n","    return (1-Jaccard_coef(y_true, y_pred))\n","\n","def bcc_Jaccard_coef_loss(y_true, y_pred):\n","    return (binary_crossentropy(y_true, y_pred)+(1-Jaccard_coef(y_true, y_pred)))"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"w_h2WpqUPkxP","colab_type":"text"},"source":["## Train and Validate the Model"]},{"cell_type":"code","metadata":{"scrolled":true,"id":"XwpgyM8UPkxQ","colab_type":"code","outputId":"c93afb9a-8ab7-4c45-ae02-f00448d52e88","colab":{}},"source":["# This is for the list of the augmentation (Geometric Augmentation). This \n","# geometric augmentation will increase the numbers of training images to\n","# overcome over-fiting and curse of dimensionality. This will act as a online \n","# aumentation that will help to reduce the memory consumtion during the \n","# Trainig phase. If you want you can augment the images before and save it to\n","# the directory and read them.\n","\n","data_gen_args = dict(rotation_range=90,\n","                    width_shift_range=0.1,\n","                    height_shift_range=0.1,\n","                    zoom_range=0.2,\n","                    horizontal_flip=True,\n","                    vertical_flip=True,\n","                    fill_mode='wrap')\n","\n","CurrentDirectory=os.getcwd()\n","\n","height=192\n","width=256\n","\n","# Calling the train generator function with required arguments. \n","TrainGen= trainGenerator(batch_size=5,\n","                         train_path=CurrentDirectory+'/',\n","                         image_folder='Train_IMAGE_ISIC_2017',\n","                         mask_folder='Train_GT_ISIC_2017',\n","                         aug_dict=data_gen_args,\n","                         image_color_mode = \"grayscale\",\n","                         mask_color_mode = \"grayscale\",\n","                         image_save_prefix  = \"image\",\n","                         mask_save_prefix  = \"mask\",\n","#                          save_to_dir = CurrentDirectory+'/aug/',\n","                         target_size = (height,width),\n","                         seed = 1)\n"," \n","# Calling the Validation/ Test generator function with required arguments. \n","TestGen= ValGenerator(batch_size=5,\n","                      val_path=CurrentDirectory+'/',\n","                      image_folder='Val_IMAGE_ISIC_2017', \n","                      mask_folder='Val_GT_ISIC_2017',\n","                      target_size = (height,width),\n","                      seed = 1)\n","\n","\n","# Calling the designed Model to train.\n","\n","model = DSNet(2, height, width)\n","\n","model.compile(optimizer = 'adadelta',\n","                loss = bcc_Jaccard_coef_loss,\n","                metrics = [Jaccard_coef])\n","\n","# This will plot a graph of the model and save it to a file. \n","plot_model(model, show_shapes=True, to_file='model.png')\n","\n","# This will print the model summary and total parameters for each operations\n","# along with total learnable parameters.\n","model.summary()\n","\n","\n","# Save the model after every epoch. You can save only the best model. If the \n","# specified metric do not improve it will not save the that current epoch. \n","\n","model_checkpoint = ModelCheckpoint('Trained_Model.hdf5',\n","                                   monitor='val_Jaccard_coef',\n","                                   verbose=1,\n","                                   mode='max',\n","                                   save_best_only=True)\n","\n","reduce_lr = ReduceLROnPlateau(monitor='val_Jaccard_coef',\n","                              factor=0.5,\n","                              patience=8,\n","                              verbose=1,\n","                              mode='max',\n","                              min_lr=0.00000001)\n","\n","early_stopping = EarlyStopping(monitor='val_Jaccard_coef',\n","                               patience=5,\n","                               verbose=1,\n","                               mode='max',\n","                               restore_best_weights=True)\n","\n","\n","# Trains the model on data generated batch-by-batch by a Python generator \n","# (or an instance of Sequence). The generator is run in parallel to the model,\n","# for efficiency. For instance, this allows you to do real-time data\n","# augmentation on images on CPU in parallel to training your model on GPU.\n","\n","\n","# history=model.fit_generator(TrainGen, \n","#                             steps_per_epoch=400, \n","#                             epochs=200, \n","#                             verbose=1, \n","#                             validation_data= TestGen, \n","#                             validation_steps=30, \n","#                             callbacks=[model_checkpoint, reduce_lr])\n"],"execution_count":0,"outputs":[{"output_type":"stream","text":["C:\\Users\\kamru\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:82: UserWarning: Update your `Model` call to the Keras 2 API: `Model(inputs=Tensor(\"in..., outputs=Tensor(\"co...)`\n"],"name":"stderr"},{"output_type":"stream","text":["__________________________________________________________________________________________________\n","Layer (type)                    Output Shape         Param #     Connected to                     \n","==================================================================================================\n","input_1 (InputLayer)            (None, 192, 256, 3)  0                                            \n","__________________________________________________________________________________________________\n","zero_padding2d_1 (ZeroPadding2D (None, 198, 262, 3)  0           input_1[0][0]                    \n","__________________________________________________________________________________________________\n","conv1/conv (Conv2D)             (None, 96, 128, 64)  9408        zero_padding2d_1[0][0]           \n","__________________________________________________________________________________________________\n","conv1/bn (BatchNormalization)   (None, 96, 128, 64)  256         conv1/conv[0][0]                 \n","__________________________________________________________________________________________________\n","conv1/relu (Activation)         (None, 96, 128, 64)  0           conv1/bn[0][0]                   \n","__________________________________________________________________________________________________\n","zero_padding2d_2 (ZeroPadding2D (None, 98, 130, 64)  0           conv1/relu[0][0]                 \n","__________________________________________________________________________________________________\n","pool1 (MaxPooling2D)            (None, 48, 64, 64)   0           zero_padding2d_2[0][0]           \n","__________________________________________________________________________________________________\n","conv2_block1_0_bn (BatchNormali (None, 48, 64, 64)   256         pool1[0][0]                      \n","__________________________________________________________________________________________________\n","conv2_block1_0_relu (Activation (None, 48, 64, 64)   0           conv2_block1_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block1_1_conv (Conv2D)    (None, 48, 64, 128)  8192        conv2_block1_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block1_1_bn (BatchNormali (None, 48, 64, 128)  512         conv2_block1_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block1_1_relu (Activation (None, 48, 64, 128)  0           conv2_block1_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block1_2_conv (Conv2D)    (None, 48, 64, 32)   36864       conv2_block1_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block1_concat (Concatenat (None, 48, 64, 96)   0           pool1[0][0]                      \n","                                                                 conv2_block1_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block2_0_bn (BatchNormali (None, 48, 64, 96)   384         conv2_block1_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block2_0_relu (Activation (None, 48, 64, 96)   0           conv2_block2_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block2_1_conv (Conv2D)    (None, 48, 64, 128)  12288       conv2_block2_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block2_1_bn (BatchNormali (None, 48, 64, 128)  512         conv2_block2_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block2_1_relu (Activation (None, 48, 64, 128)  0           conv2_block2_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block2_2_conv (Conv2D)    (None, 48, 64, 32)   36864       conv2_block2_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block2_concat (Concatenat (None, 48, 64, 128)  0           conv2_block1_concat[0][0]        \n","                                                                 conv2_block2_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block3_0_bn (BatchNormali (None, 48, 64, 128)  512         conv2_block2_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block3_0_relu (Activation (None, 48, 64, 128)  0           conv2_block3_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block3_1_conv (Conv2D)    (None, 48, 64, 128)  16384       conv2_block3_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block3_1_bn (BatchNormali (None, 48, 64, 128)  512         conv2_block3_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block3_1_relu (Activation (None, 48, 64, 128)  0           conv2_block3_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block3_2_conv (Conv2D)    (None, 48, 64, 32)   36864       conv2_block3_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block3_concat (Concatenat (None, 48, 64, 160)  0           conv2_block2_concat[0][0]        \n","                                                                 conv2_block3_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block4_0_bn (BatchNormali (None, 48, 64, 160)  640         conv2_block3_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block4_0_relu (Activation (None, 48, 64, 160)  0           conv2_block4_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block4_1_conv (Conv2D)    (None, 48, 64, 128)  20480       conv2_block4_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block4_1_bn (BatchNormali (None, 48, 64, 128)  512         conv2_block4_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block4_1_relu (Activation (None, 48, 64, 128)  0           conv2_block4_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block4_2_conv (Conv2D)    (None, 48, 64, 32)   36864       conv2_block4_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block4_concat (Concatenat (None, 48, 64, 192)  0           conv2_block3_concat[0][0]        \n","                                                                 conv2_block4_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block5_0_bn (BatchNormali (None, 48, 64, 192)  768         conv2_block4_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block5_0_relu (Activation (None, 48, 64, 192)  0           conv2_block5_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block5_1_conv (Conv2D)    (None, 48, 64, 128)  24576       conv2_block5_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block5_1_bn (BatchNormali (None, 48, 64, 128)  512         conv2_block5_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block5_1_relu (Activation (None, 48, 64, 128)  0           conv2_block5_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block5_2_conv (Conv2D)    (None, 48, 64, 32)   36864       conv2_block5_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block5_concat (Concatenat (None, 48, 64, 224)  0           conv2_block4_concat[0][0]        \n","                                                                 conv2_block5_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block6_0_bn (BatchNormali (None, 48, 64, 224)  896         conv2_block5_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block6_0_relu (Activation (None, 48, 64, 224)  0           conv2_block6_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block6_1_conv (Conv2D)    (None, 48, 64, 128)  28672       conv2_block6_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block6_1_bn (BatchNormali (None, 48, 64, 128)  512         conv2_block6_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block6_1_relu (Activation (None, 48, 64, 128)  0           conv2_block6_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv2_block6_2_conv (Conv2D)    (None, 48, 64, 32)   36864       conv2_block6_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv2_block6_concat (Concatenat (None, 48, 64, 256)  0           conv2_block5_concat[0][0]        \n","                                                                 conv2_block6_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","pool2_bn (BatchNormalization)   (None, 48, 64, 256)  1024        conv2_block6_concat[0][0]        \n","__________________________________________________________________________________________________\n","pool2_relu (Activation)         (None, 48, 64, 256)  0           pool2_bn[0][0]                   \n","__________________________________________________________________________________________________\n","pool2_conv (Conv2D)             (None, 48, 64, 128)  32768       pool2_relu[0][0]                 \n","__________________________________________________________________________________________________\n","pool2_pool (AveragePooling2D)   (None, 24, 32, 128)  0           pool2_conv[0][0]                 \n","__________________________________________________________________________________________________\n","conv3_block1_0_bn (BatchNormali (None, 24, 32, 128)  512         pool2_pool[0][0]                 \n","__________________________________________________________________________________________________\n","conv3_block1_0_relu (Activation (None, 24, 32, 128)  0           conv3_block1_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block1_1_conv (Conv2D)    (None, 24, 32, 128)  16384       conv3_block1_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block1_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block1_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block1_1_relu (Activation (None, 24, 32, 128)  0           conv3_block1_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block1_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block1_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block1_concat (Concatenat (None, 24, 32, 160)  0           pool2_pool[0][0]                 \n","                                                                 conv3_block1_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block2_0_bn (BatchNormali (None, 24, 32, 160)  640         conv3_block1_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block2_0_relu (Activation (None, 24, 32, 160)  0           conv3_block2_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block2_1_conv (Conv2D)    (None, 24, 32, 128)  20480       conv3_block2_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block2_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block2_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block2_1_relu (Activation (None, 24, 32, 128)  0           conv3_block2_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block2_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block2_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block2_concat (Concatenat (None, 24, 32, 192)  0           conv3_block1_concat[0][0]        \n","                                                                 conv3_block2_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block3_0_bn (BatchNormali (None, 24, 32, 192)  768         conv3_block2_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block3_0_relu (Activation (None, 24, 32, 192)  0           conv3_block3_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block3_1_conv (Conv2D)    (None, 24, 32, 128)  24576       conv3_block3_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block3_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block3_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block3_1_relu (Activation (None, 24, 32, 128)  0           conv3_block3_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block3_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block3_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block3_concat (Concatenat (None, 24, 32, 224)  0           conv3_block2_concat[0][0]        \n","                                                                 conv3_block3_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block4_0_bn (BatchNormali (None, 24, 32, 224)  896         conv3_block3_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block4_0_relu (Activation (None, 24, 32, 224)  0           conv3_block4_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block4_1_conv (Conv2D)    (None, 24, 32, 128)  28672       conv3_block4_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block4_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block4_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block4_1_relu (Activation (None, 24, 32, 128)  0           conv3_block4_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block4_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block4_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block4_concat (Concatenat (None, 24, 32, 256)  0           conv3_block3_concat[0][0]        \n","                                                                 conv3_block4_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block5_0_bn (BatchNormali (None, 24, 32, 256)  1024        conv3_block4_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block5_0_relu (Activation (None, 24, 32, 256)  0           conv3_block5_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block5_1_conv (Conv2D)    (None, 24, 32, 128)  32768       conv3_block5_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block5_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block5_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block5_1_relu (Activation (None, 24, 32, 128)  0           conv3_block5_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block5_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block5_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block5_concat (Concatenat (None, 24, 32, 288)  0           conv3_block4_concat[0][0]        \n","                                                                 conv3_block5_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block6_0_bn (BatchNormali (None, 24, 32, 288)  1152        conv3_block5_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block6_0_relu (Activation (None, 24, 32, 288)  0           conv3_block6_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block6_1_conv (Conv2D)    (None, 24, 32, 128)  36864       conv3_block6_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block6_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block6_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block6_1_relu (Activation (None, 24, 32, 128)  0           conv3_block6_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block6_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block6_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block6_concat (Concatenat (None, 24, 32, 320)  0           conv3_block5_concat[0][0]        \n","                                                                 conv3_block6_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block7_0_bn (BatchNormali (None, 24, 32, 320)  1280        conv3_block6_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block7_0_relu (Activation (None, 24, 32, 320)  0           conv3_block7_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block7_1_conv (Conv2D)    (None, 24, 32, 128)  40960       conv3_block7_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block7_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block7_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block7_1_relu (Activation (None, 24, 32, 128)  0           conv3_block7_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block7_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block7_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block7_concat (Concatenat (None, 24, 32, 352)  0           conv3_block6_concat[0][0]        \n","                                                                 conv3_block7_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block8_0_bn (BatchNormali (None, 24, 32, 352)  1408        conv3_block7_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block8_0_relu (Activation (None, 24, 32, 352)  0           conv3_block8_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block8_1_conv (Conv2D)    (None, 24, 32, 128)  45056       conv3_block8_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block8_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block8_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block8_1_relu (Activation (None, 24, 32, 128)  0           conv3_block8_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block8_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block8_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block8_concat (Concatenat (None, 24, 32, 384)  0           conv3_block7_concat[0][0]        \n","                                                                 conv3_block8_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block9_0_bn (BatchNormali (None, 24, 32, 384)  1536        conv3_block8_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block9_0_relu (Activation (None, 24, 32, 384)  0           conv3_block9_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block9_1_conv (Conv2D)    (None, 24, 32, 128)  49152       conv3_block9_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block9_1_bn (BatchNormali (None, 24, 32, 128)  512         conv3_block9_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block9_1_relu (Activation (None, 24, 32, 128)  0           conv3_block9_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv3_block9_2_conv (Conv2D)    (None, 24, 32, 32)   36864       conv3_block9_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block9_concat (Concatenat (None, 24, 32, 416)  0           conv3_block8_concat[0][0]        \n","                                                                 conv3_block9_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block10_0_bn (BatchNormal (None, 24, 32, 416)  1664        conv3_block9_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv3_block10_0_relu (Activatio (None, 24, 32, 416)  0           conv3_block10_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv3_block10_1_conv (Conv2D)   (None, 24, 32, 128)  53248       conv3_block10_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block10_1_bn (BatchNormal (None, 24, 32, 128)  512         conv3_block10_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block10_1_relu (Activatio (None, 24, 32, 128)  0           conv3_block10_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv3_block10_2_conv (Conv2D)   (None, 24, 32, 32)   36864       conv3_block10_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block10_concat (Concatena (None, 24, 32, 448)  0           conv3_block9_concat[0][0]        \n","                                                                 conv3_block10_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block11_0_bn (BatchNormal (None, 24, 32, 448)  1792        conv3_block10_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block11_0_relu (Activatio (None, 24, 32, 448)  0           conv3_block11_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv3_block11_1_conv (Conv2D)   (None, 24, 32, 128)  57344       conv3_block11_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block11_1_bn (BatchNormal (None, 24, 32, 128)  512         conv3_block11_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block11_1_relu (Activatio (None, 24, 32, 128)  0           conv3_block11_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv3_block11_2_conv (Conv2D)   (None, 24, 32, 32)   36864       conv3_block11_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block11_concat (Concatena (None, 24, 32, 480)  0           conv3_block10_concat[0][0]       \n","                                                                 conv3_block11_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block12_0_bn (BatchNormal (None, 24, 32, 480)  1920        conv3_block11_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block12_0_relu (Activatio (None, 24, 32, 480)  0           conv3_block12_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv3_block12_1_conv (Conv2D)   (None, 24, 32, 128)  61440       conv3_block12_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block12_1_bn (BatchNormal (None, 24, 32, 128)  512         conv3_block12_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block12_1_relu (Activatio (None, 24, 32, 128)  0           conv3_block12_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv3_block12_2_conv (Conv2D)   (None, 24, 32, 32)   36864       conv3_block12_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv3_block12_concat (Concatena (None, 24, 32, 512)  0           conv3_block11_concat[0][0]       \n","                                                                 conv3_block12_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","pool3_bn (BatchNormalization)   (None, 24, 32, 512)  2048        conv3_block12_concat[0][0]       \n","__________________________________________________________________________________________________\n","pool3_relu (Activation)         (None, 24, 32, 512)  0           pool3_bn[0][0]                   \n","__________________________________________________________________________________________________\n","pool3_conv (Conv2D)             (None, 24, 32, 256)  131072      pool3_relu[0][0]                 \n","__________________________________________________________________________________________________\n","pool3_pool (AveragePooling2D)   (None, 12, 16, 256)  0           pool3_conv[0][0]                 \n","__________________________________________________________________________________________________\n","conv4_block1_0_bn (BatchNormali (None, 12, 16, 256)  1024        pool3_pool[0][0]                 \n","__________________________________________________________________________________________________\n","conv4_block1_0_relu (Activation (None, 12, 16, 256)  0           conv4_block1_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block1_1_conv (Conv2D)    (None, 12, 16, 128)  32768       conv4_block1_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block1_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block1_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block1_1_relu (Activation (None, 12, 16, 128)  0           conv4_block1_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block1_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block1_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block1_concat (Concatenat (None, 12, 16, 288)  0           pool3_pool[0][0]                 \n","                                                                 conv4_block1_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block2_0_bn (BatchNormali (None, 12, 16, 288)  1152        conv4_block1_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block2_0_relu (Activation (None, 12, 16, 288)  0           conv4_block2_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block2_1_conv (Conv2D)    (None, 12, 16, 128)  36864       conv4_block2_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block2_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block2_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block2_1_relu (Activation (None, 12, 16, 128)  0           conv4_block2_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block2_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block2_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block2_concat (Concatenat (None, 12, 16, 320)  0           conv4_block1_concat[0][0]        \n","                                                                 conv4_block2_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block3_0_bn (BatchNormali (None, 12, 16, 320)  1280        conv4_block2_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block3_0_relu (Activation (None, 12, 16, 320)  0           conv4_block3_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block3_1_conv (Conv2D)    (None, 12, 16, 128)  40960       conv4_block3_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block3_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block3_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block3_1_relu (Activation (None, 12, 16, 128)  0           conv4_block3_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block3_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block3_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block3_concat (Concatenat (None, 12, 16, 352)  0           conv4_block2_concat[0][0]        \n","                                                                 conv4_block3_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block4_0_bn (BatchNormali (None, 12, 16, 352)  1408        conv4_block3_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block4_0_relu (Activation (None, 12, 16, 352)  0           conv4_block4_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block4_1_conv (Conv2D)    (None, 12, 16, 128)  45056       conv4_block4_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block4_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block4_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block4_1_relu (Activation (None, 12, 16, 128)  0           conv4_block4_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block4_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block4_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block4_concat (Concatenat (None, 12, 16, 384)  0           conv4_block3_concat[0][0]        \n","                                                                 conv4_block4_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block5_0_bn (BatchNormali (None, 12, 16, 384)  1536        conv4_block4_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block5_0_relu (Activation (None, 12, 16, 384)  0           conv4_block5_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block5_1_conv (Conv2D)    (None, 12, 16, 128)  49152       conv4_block5_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block5_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block5_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block5_1_relu (Activation (None, 12, 16, 128)  0           conv4_block5_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block5_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block5_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block5_concat (Concatenat (None, 12, 16, 416)  0           conv4_block4_concat[0][0]        \n","                                                                 conv4_block5_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block6_0_bn (BatchNormali (None, 12, 16, 416)  1664        conv4_block5_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block6_0_relu (Activation (None, 12, 16, 416)  0           conv4_block6_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block6_1_conv (Conv2D)    (None, 12, 16, 128)  53248       conv4_block6_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block6_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block6_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block6_1_relu (Activation (None, 12, 16, 128)  0           conv4_block6_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block6_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block6_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block6_concat (Concatenat (None, 12, 16, 448)  0           conv4_block5_concat[0][0]        \n","                                                                 conv4_block6_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block7_0_bn (BatchNormali (None, 12, 16, 448)  1792        conv4_block6_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block7_0_relu (Activation (None, 12, 16, 448)  0           conv4_block7_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block7_1_conv (Conv2D)    (None, 12, 16, 128)  57344       conv4_block7_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block7_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block7_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block7_1_relu (Activation (None, 12, 16, 128)  0           conv4_block7_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block7_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block7_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block7_concat (Concatenat (None, 12, 16, 480)  0           conv4_block6_concat[0][0]        \n","                                                                 conv4_block7_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block8_0_bn (BatchNormali (None, 12, 16, 480)  1920        conv4_block7_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block8_0_relu (Activation (None, 12, 16, 480)  0           conv4_block8_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block8_1_conv (Conv2D)    (None, 12, 16, 128)  61440       conv4_block8_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block8_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block8_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block8_1_relu (Activation (None, 12, 16, 128)  0           conv4_block8_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block8_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block8_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block8_concat (Concatenat (None, 12, 16, 512)  0           conv4_block7_concat[0][0]        \n","                                                                 conv4_block8_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block9_0_bn (BatchNormali (None, 12, 16, 512)  2048        conv4_block8_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block9_0_relu (Activation (None, 12, 16, 512)  0           conv4_block9_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block9_1_conv (Conv2D)    (None, 12, 16, 128)  65536       conv4_block9_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block9_1_bn (BatchNormali (None, 12, 16, 128)  512         conv4_block9_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block9_1_relu (Activation (None, 12, 16, 128)  0           conv4_block9_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv4_block9_2_conv (Conv2D)    (None, 12, 16, 32)   36864       conv4_block9_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block9_concat (Concatenat (None, 12, 16, 544)  0           conv4_block8_concat[0][0]        \n","                                                                 conv4_block9_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block10_0_bn (BatchNormal (None, 12, 16, 544)  2176        conv4_block9_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv4_block10_0_relu (Activatio (None, 12, 16, 544)  0           conv4_block10_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block10_1_conv (Conv2D)   (None, 12, 16, 128)  69632       conv4_block10_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block10_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block10_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block10_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block10_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block10_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block10_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block10_concat (Concatena (None, 12, 16, 576)  0           conv4_block9_concat[0][0]        \n","                                                                 conv4_block10_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block11_0_bn (BatchNormal (None, 12, 16, 576)  2304        conv4_block10_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block11_0_relu (Activatio (None, 12, 16, 576)  0           conv4_block11_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block11_1_conv (Conv2D)   (None, 12, 16, 128)  73728       conv4_block11_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block11_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block11_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block11_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block11_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block11_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block11_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block11_concat (Concatena (None, 12, 16, 608)  0           conv4_block10_concat[0][0]       \n","                                                                 conv4_block11_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block12_0_bn (BatchNormal (None, 12, 16, 608)  2432        conv4_block11_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block12_0_relu (Activatio (None, 12, 16, 608)  0           conv4_block12_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block12_1_conv (Conv2D)   (None, 12, 16, 128)  77824       conv4_block12_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block12_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block12_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block12_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block12_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block12_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block12_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block12_concat (Concatena (None, 12, 16, 640)  0           conv4_block11_concat[0][0]       \n","                                                                 conv4_block12_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block13_0_bn (BatchNormal (None, 12, 16, 640)  2560        conv4_block12_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block13_0_relu (Activatio (None, 12, 16, 640)  0           conv4_block13_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block13_1_conv (Conv2D)   (None, 12, 16, 128)  81920       conv4_block13_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block13_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block13_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block13_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block13_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block13_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block13_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block13_concat (Concatena (None, 12, 16, 672)  0           conv4_block12_concat[0][0]       \n","                                                                 conv4_block13_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block14_0_bn (BatchNormal (None, 12, 16, 672)  2688        conv4_block13_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block14_0_relu (Activatio (None, 12, 16, 672)  0           conv4_block14_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block14_1_conv (Conv2D)   (None, 12, 16, 128)  86016       conv4_block14_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block14_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block14_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block14_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block14_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block14_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block14_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block14_concat (Concatena (None, 12, 16, 704)  0           conv4_block13_concat[0][0]       \n","                                                                 conv4_block14_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block15_0_bn (BatchNormal (None, 12, 16, 704)  2816        conv4_block14_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block15_0_relu (Activatio (None, 12, 16, 704)  0           conv4_block15_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block15_1_conv (Conv2D)   (None, 12, 16, 128)  90112       conv4_block15_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block15_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block15_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block15_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block15_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block15_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block15_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block15_concat (Concatena (None, 12, 16, 736)  0           conv4_block14_concat[0][0]       \n","                                                                 conv4_block15_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block16_0_bn (BatchNormal (None, 12, 16, 736)  2944        conv4_block15_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block16_0_relu (Activatio (None, 12, 16, 736)  0           conv4_block16_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block16_1_conv (Conv2D)   (None, 12, 16, 128)  94208       conv4_block16_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block16_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block16_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block16_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block16_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block16_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block16_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block16_concat (Concatena (None, 12, 16, 768)  0           conv4_block15_concat[0][0]       \n","                                                                 conv4_block16_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block17_0_bn (BatchNormal (None, 12, 16, 768)  3072        conv4_block16_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block17_0_relu (Activatio (None, 12, 16, 768)  0           conv4_block17_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block17_1_conv (Conv2D)   (None, 12, 16, 128)  98304       conv4_block17_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block17_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block17_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block17_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block17_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block17_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block17_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block17_concat (Concatena (None, 12, 16, 800)  0           conv4_block16_concat[0][0]       \n","                                                                 conv4_block17_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block18_0_bn (BatchNormal (None, 12, 16, 800)  3200        conv4_block17_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block18_0_relu (Activatio (None, 12, 16, 800)  0           conv4_block18_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block18_1_conv (Conv2D)   (None, 12, 16, 128)  102400      conv4_block18_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block18_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block18_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block18_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block18_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block18_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block18_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block18_concat (Concatena (None, 12, 16, 832)  0           conv4_block17_concat[0][0]       \n","                                                                 conv4_block18_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block19_0_bn (BatchNormal (None, 12, 16, 832)  3328        conv4_block18_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block19_0_relu (Activatio (None, 12, 16, 832)  0           conv4_block19_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block19_1_conv (Conv2D)   (None, 12, 16, 128)  106496      conv4_block19_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block19_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block19_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block19_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block19_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block19_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block19_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block19_concat (Concatena (None, 12, 16, 864)  0           conv4_block18_concat[0][0]       \n","                                                                 conv4_block19_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block20_0_bn (BatchNormal (None, 12, 16, 864)  3456        conv4_block19_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block20_0_relu (Activatio (None, 12, 16, 864)  0           conv4_block20_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block20_1_conv (Conv2D)   (None, 12, 16, 128)  110592      conv4_block20_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block20_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block20_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block20_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block20_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block20_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block20_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block20_concat (Concatena (None, 12, 16, 896)  0           conv4_block19_concat[0][0]       \n","                                                                 conv4_block20_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block21_0_bn (BatchNormal (None, 12, 16, 896)  3584        conv4_block20_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block21_0_relu (Activatio (None, 12, 16, 896)  0           conv4_block21_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block21_1_conv (Conv2D)   (None, 12, 16, 128)  114688      conv4_block21_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block21_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block21_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block21_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block21_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block21_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block21_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block21_concat (Concatena (None, 12, 16, 928)  0           conv4_block20_concat[0][0]       \n","                                                                 conv4_block21_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block22_0_bn (BatchNormal (None, 12, 16, 928)  3712        conv4_block21_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block22_0_relu (Activatio (None, 12, 16, 928)  0           conv4_block22_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block22_1_conv (Conv2D)   (None, 12, 16, 128)  118784      conv4_block22_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block22_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block22_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block22_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block22_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block22_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block22_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block22_concat (Concatena (None, 12, 16, 960)  0           conv4_block21_concat[0][0]       \n","                                                                 conv4_block22_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block23_0_bn (BatchNormal (None, 12, 16, 960)  3840        conv4_block22_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block23_0_relu (Activatio (None, 12, 16, 960)  0           conv4_block23_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block23_1_conv (Conv2D)   (None, 12, 16, 128)  122880      conv4_block23_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block23_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block23_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block23_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block23_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block23_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block23_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block23_concat (Concatena (None, 12, 16, 992)  0           conv4_block22_concat[0][0]       \n","                                                                 conv4_block23_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block24_0_bn (BatchNormal (None, 12, 16, 992)  3968        conv4_block23_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block24_0_relu (Activatio (None, 12, 16, 992)  0           conv4_block24_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block24_1_conv (Conv2D)   (None, 12, 16, 128)  126976      conv4_block24_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block24_1_bn (BatchNormal (None, 12, 16, 128)  512         conv4_block24_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block24_1_relu (Activatio (None, 12, 16, 128)  0           conv4_block24_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv4_block24_2_conv (Conv2D)   (None, 12, 16, 32)   36864       conv4_block24_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv4_block24_concat (Concatena (None, 12, 16, 1024) 0           conv4_block23_concat[0][0]       \n","                                                                 conv4_block24_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","pool4_bn (BatchNormalization)   (None, 12, 16, 1024) 4096        conv4_block24_concat[0][0]       \n","__________________________________________________________________________________________________\n","pool4_relu (Activation)         (None, 12, 16, 1024) 0           pool4_bn[0][0]                   \n","__________________________________________________________________________________________________\n","pool4_conv (Conv2D)             (None, 12, 16, 512)  524288      pool4_relu[0][0]                 \n","__________________________________________________________________________________________________\n","pool4_pool (AveragePooling2D)   (None, 6, 8, 512)    0           pool4_conv[0][0]                 \n","__________________________________________________________________________________________________\n","conv5_block1_0_bn (BatchNormali (None, 6, 8, 512)    2048        pool4_pool[0][0]                 \n","__________________________________________________________________________________________________\n","conv5_block1_0_relu (Activation (None, 6, 8, 512)    0           conv5_block1_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block1_1_conv (Conv2D)    (None, 6, 8, 128)    65536       conv5_block1_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block1_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block1_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block1_1_relu (Activation (None, 6, 8, 128)    0           conv5_block1_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block1_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block1_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block1_concat (Concatenat (None, 6, 8, 544)    0           pool4_pool[0][0]                 \n","                                                                 conv5_block1_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block2_0_bn (BatchNormali (None, 6, 8, 544)    2176        conv5_block1_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block2_0_relu (Activation (None, 6, 8, 544)    0           conv5_block2_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block2_1_conv (Conv2D)    (None, 6, 8, 128)    69632       conv5_block2_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block2_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block2_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block2_1_relu (Activation (None, 6, 8, 128)    0           conv5_block2_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block2_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block2_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block2_concat (Concatenat (None, 6, 8, 576)    0           conv5_block1_concat[0][0]        \n","                                                                 conv5_block2_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block3_0_bn (BatchNormali (None, 6, 8, 576)    2304        conv5_block2_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block3_0_relu (Activation (None, 6, 8, 576)    0           conv5_block3_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block3_1_conv (Conv2D)    (None, 6, 8, 128)    73728       conv5_block3_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block3_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block3_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block3_1_relu (Activation (None, 6, 8, 128)    0           conv5_block3_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block3_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block3_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block3_concat (Concatenat (None, 6, 8, 608)    0           conv5_block2_concat[0][0]        \n","                                                                 conv5_block3_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block4_0_bn (BatchNormali (None, 6, 8, 608)    2432        conv5_block3_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block4_0_relu (Activation (None, 6, 8, 608)    0           conv5_block4_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block4_1_conv (Conv2D)    (None, 6, 8, 128)    77824       conv5_block4_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block4_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block4_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block4_1_relu (Activation (None, 6, 8, 128)    0           conv5_block4_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block4_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block4_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block4_concat (Concatenat (None, 6, 8, 640)    0           conv5_block3_concat[0][0]        \n","                                                                 conv5_block4_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block5_0_bn (BatchNormali (None, 6, 8, 640)    2560        conv5_block4_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block5_0_relu (Activation (None, 6, 8, 640)    0           conv5_block5_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block5_1_conv (Conv2D)    (None, 6, 8, 128)    81920       conv5_block5_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block5_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block5_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block5_1_relu (Activation (None, 6, 8, 128)    0           conv5_block5_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block5_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block5_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block5_concat (Concatenat (None, 6, 8, 672)    0           conv5_block4_concat[0][0]        \n","                                                                 conv5_block5_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block6_0_bn (BatchNormali (None, 6, 8, 672)    2688        conv5_block5_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block6_0_relu (Activation (None, 6, 8, 672)    0           conv5_block6_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block6_1_conv (Conv2D)    (None, 6, 8, 128)    86016       conv5_block6_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block6_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block6_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block6_1_relu (Activation (None, 6, 8, 128)    0           conv5_block6_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block6_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block6_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block6_concat (Concatenat (None, 6, 8, 704)    0           conv5_block5_concat[0][0]        \n","                                                                 conv5_block6_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block7_0_bn (BatchNormali (None, 6, 8, 704)    2816        conv5_block6_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block7_0_relu (Activation (None, 6, 8, 704)    0           conv5_block7_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block7_1_conv (Conv2D)    (None, 6, 8, 128)    90112       conv5_block7_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block7_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block7_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block7_1_relu (Activation (None, 6, 8, 128)    0           conv5_block7_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block7_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block7_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block7_concat (Concatenat (None, 6, 8, 736)    0           conv5_block6_concat[0][0]        \n","                                                                 conv5_block7_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block8_0_bn (BatchNormali (None, 6, 8, 736)    2944        conv5_block7_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block8_0_relu (Activation (None, 6, 8, 736)    0           conv5_block8_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block8_1_conv (Conv2D)    (None, 6, 8, 128)    94208       conv5_block8_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block8_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block8_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block8_1_relu (Activation (None, 6, 8, 128)    0           conv5_block8_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block8_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block8_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block8_concat (Concatenat (None, 6, 8, 768)    0           conv5_block7_concat[0][0]        \n","                                                                 conv5_block8_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block9_0_bn (BatchNormali (None, 6, 8, 768)    3072        conv5_block8_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block9_0_relu (Activation (None, 6, 8, 768)    0           conv5_block9_0_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block9_1_conv (Conv2D)    (None, 6, 8, 128)    98304       conv5_block9_0_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block9_1_bn (BatchNormali (None, 6, 8, 128)    512         conv5_block9_1_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block9_1_relu (Activation (None, 6, 8, 128)    0           conv5_block9_1_bn[0][0]          \n","__________________________________________________________________________________________________\n","conv5_block9_2_conv (Conv2D)    (None, 6, 8, 32)     36864       conv5_block9_1_relu[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block9_concat (Concatenat (None, 6, 8, 800)    0           conv5_block8_concat[0][0]        \n","                                                                 conv5_block9_2_conv[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block10_0_bn (BatchNormal (None, 6, 8, 800)    3200        conv5_block9_concat[0][0]        \n","__________________________________________________________________________________________________\n","conv5_block10_0_relu (Activatio (None, 6, 8, 800)    0           conv5_block10_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block10_1_conv (Conv2D)   (None, 6, 8, 128)    102400      conv5_block10_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block10_1_bn (BatchNormal (None, 6, 8, 128)    512         conv5_block10_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block10_1_relu (Activatio (None, 6, 8, 128)    0           conv5_block10_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block10_2_conv (Conv2D)   (None, 6, 8, 32)     36864       conv5_block10_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block10_concat (Concatena (None, 6, 8, 832)    0           conv5_block9_concat[0][0]        \n","                                                                 conv5_block10_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block11_0_bn (BatchNormal (None, 6, 8, 832)    3328        conv5_block10_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block11_0_relu (Activatio (None, 6, 8, 832)    0           conv5_block11_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block11_1_conv (Conv2D)   (None, 6, 8, 128)    106496      conv5_block11_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block11_1_bn (BatchNormal (None, 6, 8, 128)    512         conv5_block11_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block11_1_relu (Activatio (None, 6, 8, 128)    0           conv5_block11_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block11_2_conv (Conv2D)   (None, 6, 8, 32)     36864       conv5_block11_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block11_concat (Concatena (None, 6, 8, 864)    0           conv5_block10_concat[0][0]       \n","                                                                 conv5_block11_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block12_0_bn (BatchNormal (None, 6, 8, 864)    3456        conv5_block11_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block12_0_relu (Activatio (None, 6, 8, 864)    0           conv5_block12_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block12_1_conv (Conv2D)   (None, 6, 8, 128)    110592      conv5_block12_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block12_1_bn (BatchNormal (None, 6, 8, 128)    512         conv5_block12_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block12_1_relu (Activatio (None, 6, 8, 128)    0           conv5_block12_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block12_2_conv (Conv2D)   (None, 6, 8, 32)     36864       conv5_block12_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block12_concat (Concatena (None, 6, 8, 896)    0           conv5_block11_concat[0][0]       \n","                                                                 conv5_block12_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block13_0_bn (BatchNormal (None, 6, 8, 896)    3584        conv5_block12_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block13_0_relu (Activatio (None, 6, 8, 896)    0           conv5_block13_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block13_1_conv (Conv2D)   (None, 6, 8, 128)    114688      conv5_block13_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block13_1_bn (BatchNormal (None, 6, 8, 128)    512         conv5_block13_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block13_1_relu (Activatio (None, 6, 8, 128)    0           conv5_block13_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block13_2_conv (Conv2D)   (None, 6, 8, 32)     36864       conv5_block13_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block13_concat (Concatena (None, 6, 8, 928)    0           conv5_block12_concat[0][0]       \n","                                                                 conv5_block13_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block14_0_bn (BatchNormal (None, 6, 8, 928)    3712        conv5_block13_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block14_0_relu (Activatio (None, 6, 8, 928)    0           conv5_block14_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block14_1_conv (Conv2D)   (None, 6, 8, 128)    118784      conv5_block14_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block14_1_bn (BatchNormal (None, 6, 8, 128)    512         conv5_block14_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block14_1_relu (Activatio (None, 6, 8, 128)    0           conv5_block14_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block14_2_conv (Conv2D)   (None, 6, 8, 32)     36864       conv5_block14_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block14_concat (Concatena (None, 6, 8, 960)    0           conv5_block13_concat[0][0]       \n","                                                                 conv5_block14_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block15_0_bn (BatchNormal (None, 6, 8, 960)    3840        conv5_block14_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block15_0_relu (Activatio (None, 6, 8, 960)    0           conv5_block15_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block15_1_conv (Conv2D)   (None, 6, 8, 128)    122880      conv5_block15_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block15_1_bn (BatchNormal (None, 6, 8, 128)    512         conv5_block15_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block15_1_relu (Activatio (None, 6, 8, 128)    0           conv5_block15_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block15_2_conv (Conv2D)   (None, 6, 8, 32)     36864       conv5_block15_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block15_concat (Concatena (None, 6, 8, 992)    0           conv5_block14_concat[0][0]       \n","                                                                 conv5_block15_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block16_0_bn (BatchNormal (None, 6, 8, 992)    3968        conv5_block15_concat[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block16_0_relu (Activatio (None, 6, 8, 992)    0           conv5_block16_0_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block16_1_conv (Conv2D)   (None, 6, 8, 128)    126976      conv5_block16_0_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block16_1_bn (BatchNormal (None, 6, 8, 128)    512         conv5_block16_1_conv[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block16_1_relu (Activatio (None, 6, 8, 128)    0           conv5_block16_1_bn[0][0]         \n","__________________________________________________________________________________________________\n","conv5_block16_2_conv (Conv2D)   (None, 6, 8, 32)     36864       conv5_block16_1_relu[0][0]       \n","__________________________________________________________________________________________________\n","conv5_block16_concat (Concatena (None, 6, 8, 1024)   0           conv5_block15_concat[0][0]       \n","                                                                 conv5_block16_2_conv[0][0]       \n","__________________________________________________________________________________________________\n","bn (BatchNormalization)         (None, 6, 8, 1024)   4096        conv5_block16_concat[0][0]       \n","__________________________________________________________________________________________________\n","relu (Activation)               (None, 6, 8, 1024)   0           bn[0][0]                         \n","__________________________________________________________________________________________________\n","separable_conv2d_1 (SeparableCo (None, 6, 8, 1024)   1058816     relu[0][0]                       \n","__________________________________________________________________________________________________\n","batch_normalization_1 (BatchNor (None, 6, 8, 1024)   4096        separable_conv2d_1[0][0]         \n","__________________________________________________________________________________________________\n","up_sampling2d_1 (UpSampling2D)  (None, 12, 16, 1024) 0           batch_normalization_1[0][0]      \n","__________________________________________________________________________________________________\n","concatenate_1 (Concatenate)     (None, 12, 16, 1280) 0           pool3_pool[0][0]                 \n","                                                                 up_sampling2d_1[0][0]            \n","__________________________________________________________________________________________________\n","separable_conv2d_2 (SeparableCo (None, 12, 16, 1024) 1323264     concatenate_1[0][0]              \n","__________________________________________________________________________________________________\n","batch_normalization_2 (BatchNor (None, 12, 16, 1024) 4096        separable_conv2d_2[0][0]         \n","__________________________________________________________________________________________________\n","up_sampling2d_2 (UpSampling2D)  (None, 24, 32, 1024) 0           batch_normalization_2[0][0]      \n","__________________________________________________________________________________________________\n","concatenate_2 (Concatenate)     (None, 24, 32, 1152) 0           pool2_pool[0][0]                 \n","                                                                 up_sampling2d_2[0][0]            \n","__________________________________________________________________________________________________\n","separable_conv2d_3 (SeparableCo (None, 24, 32, 512)  600704      concatenate_2[0][0]              \n","__________________________________________________________________________________________________\n","batch_normalization_3 (BatchNor (None, 24, 32, 512)  2048        separable_conv2d_3[0][0]         \n","__________________________________________________________________________________________________\n","up_sampling2d_3 (UpSampling2D)  (None, 48, 64, 512)  0           batch_normalization_3[0][0]      \n","__________________________________________________________________________________________________\n","concatenate_3 (Concatenate)     (None, 48, 64, 576)  0           pool1[0][0]                      \n","                                                                 up_sampling2d_3[0][0]            \n","__________________________________________________________________________________________________\n","separable_conv2d_4 (SeparableCo (None, 48, 64, 256)  152896      concatenate_3[0][0]              \n","__________________________________________________________________________________________________\n","batch_normalization_4 (BatchNor (None, 48, 64, 256)  1024        separable_conv2d_4[0][0]         \n","__________________________________________________________________________________________________\n","up_sampling2d_4 (UpSampling2D)  (None, 96, 128, 256) 0           batch_normalization_4[0][0]      \n","__________________________________________________________________________________________________\n","concatenate_4 (Concatenate)     (None, 96, 128, 320) 0           conv1/bn[0][0]                   \n","                                                                 up_sampling2d_4[0][0]            \n","__________________________________________________________________________________________________\n","separable_conv2d_5 (SeparableCo (None, 96, 128, 128) 43968       concatenate_4[0][0]              \n","__________________________________________________________________________________________________\n","batch_normalization_5 (BatchNor (None, 96, 128, 128) 512         separable_conv2d_5[0][0]         \n","__________________________________________________________________________________________________\n","up_sampling2d_5 (UpSampling2D)  (None, 192, 256, 128 0           batch_normalization_5[0][0]      \n","__________________________________________________________________________________________________\n","separable_conv2d_6 (SeparableCo (None, 192, 256, 64) 9408        up_sampling2d_5[0][0]            \n","__________________________________________________________________________________________________\n","batch_normalization_6 (BatchNor (None, 192, 256, 64) 256         separable_conv2d_6[0][0]         \n","__________________________________________________________________________________________________\n","separable_conv2d_7 (SeparableCo (None, 192, 256, 2)  194         batch_normalization_6[0][0]      \n","__________________________________________________________________________________________________\n","batch_normalization_7 (BatchNor (None, 192, 256, 2)  8           separable_conv2d_7[0][0]         \n","__________________________________________________________________________________________________\n","conv2d_1 (Conv2D)               (None, 192, 256, 1)  3           batch_normalization_7[0][0]      \n","==================================================================================================\n","Total params: 10,238,797\n","Trainable params: 10,149,129\n","Non-trainable params: 89,668\n","__________________________________________________________________________________________________\n"],"name":"stdout"}]},{"cell_type":"markdown","metadata":{"id":"zFaGVLA7PkxT","colab_type":"text"},"source":["## Plotting the train and validation performance"]},{"cell_type":"code","metadata":{"id":"C7ypdAa2PkxT","colab_type":"code","colab":{}},"source":["# # Plot training & validation accuracy values\n","# plt.plot(history.history['Jaccard_coef'])\n","# plt.plot(history.history['val_Jaccard_coef'])\n","# plt.title('Model accuracy')\n","# plt.ylabel('dice_coef')\n","# plt.xlabel('Epoch')\n","# plt.legend(['Train', 'Test'], loc='upper right')\n","# plt.grid('on')\n","# plt.show()\n","\n","# # Plot training & validation loss values\n","# plt.plot(history.history['loss'])\n","# plt.plot(history.history['val_loss'])\n","# plt.title('Model loss')\n","# plt.ylabel('Loss')\n","# plt.xlabel('Epoch')\n","# plt.legend(['Train', 'Test'], loc='upper right')\n","# plt.grid('on')\n","# plt.show()"],"execution_count":0,"outputs":[]},{"cell_type":"code","metadata":{"id":"4YBLPAmxPkxW","colab_type":"code","colab":{}},"source":["def Performance_Metrics(y_true, y_pred):\n","    ''' \n","    The Dice similarity coefficient (DSC) is a statistical validation metric for the image\n","    segmentations and determines the spatial overlap accuracy of the segmentation. It also \n","    same as F1-score. \n","    \n","    The Intersection over Union (IoU) also referred to as the Jaccard index (JI), is essentially\n","    a method to quantify the percent overlap between the GT mask and prediction output.\n","    This metric is closely related to the DSC. The IoU metric measures the number of pixels\n","    common between the target and prediction masks divided by the total number of pixels present\n","    across both masks.\n","    \n","    Mathematically, they are related as follows:\n","    IoU = DSC/(2-DSC) or DSC = 2*IoU/(IoU+1)\n","    \n","    The Sensitivity also called the true positive rate, the recall, or probability of detection that \n","    measures the proportion of actual positives that are correctly identified as such class \n","    (e.g., the percentage of sick people who are correctly identified as having the condition).\n","    \n","    The Specificity also called the true negative rate measures the proportion of actual negatives that\n","    are correctly identified as such class. (e.g., the percentage of healthy people who are correctly\n","    identified as not having the condition).\n","    \n","  \n","    Input Arguments: \n","        y_true: True Labels of the 2D images so called ground truth (GT).\n","        y_pred: Predicted Labels of the 2D images so called Predicted/ segmented Mask.\n","        \n","    Output Arguments: \n","        dsc: The DSC between y_true and y_pred\n","        iou: The IoU between y_true and y_pred\n","        accuracy: The accuracy of pixels clasification.\n","        sensitivity: The accuracy of foreground pixels clasification.\n","        specificity: The accuracy of background pixels clasification.\n","        balancedAccuracy: The balanced accuracy of both foreground & background pixels clasification.\n","        \n","    Author: Md. Kamrul Hasan, \n","            Erasmus Scholar on Medical Imaging and Application (MAIA)\n","            E-mail: kamruleeekuet@gmail.com\n","\n","    '''\n","    if y_true.shape != y_pred.shape:\n","        raise ValueError(\"Shape mismatch!! y_true and y_pred must have the same shape.\")\n","\n","    y_true_f = (y_true/y_true.max()).flatten()\n","    y_pred_f = (y_pred/y_pred.max()).flatten()\n","    \n","    intersection = np.sum(y_true_f * y_pred_f)\n","    \n","    dsc = (2. * intersection ) / (np.sum(y_true_f) + np.sum(y_pred_f))\n","    iou = (intersection) / (np.sum(y_true_f) + np.sum(y_pred_f)-intersection)\n","    \n","    y_true = np.asarray(y_true).astype(np.bool)\n","    y_pred = np.asarray(y_pred).astype(np.bool)\n","\n","        \n","    y_true=y_true.flatten()\n","    y_pred=y_pred.flatten()\n","    \n","    tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel()\n","    accuracy = (tn+tp)/(tn+fp+fn+tp)\n","    sensitivity = (tp)/(fn+tp)\n","    specificity = (tn)/(tn+fp)\n","    balancedAccuracy = (sensitivity+specificity)/2\n","\n","    \n","    return dsc, iou, accuracy, sensitivity, specificity, balancedAccuracy"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"0rBVOlJRSzOP","colab_type":"text"},"source":["## Mask Prediction from DSNet"]},{"cell_type":"code","metadata":{"id":"tGZmY59lPkxc","colab_type":"code","outputId":"ebb62be7-762b-465b-cced-858cdd608bc1","colab":{}},"source":["# Predict the masks using the proposed DSNet and those masks are processed using \n","# the “DSNet_Performance.m” to estimate the performance metrics. The ROC curves \n","# are plotted using the “ROC_DSNet.ipynb” \n","\n","testImagePath =CurrentDirectory+\"/Test_IMAGE_ISIC_2017/\"\n","imagePath = glob.glob(testImagePath+\"*.jpg\")\n","imagePath.sort()\n","print(len(imagePath))\n","\n","GTPath= CurrentDirectory+\"/Test_GT_ISIC_2017/\"\n","GT = glob.glob(GTPath+\"*.png\")\n","GT.sort()\n","print(len(GT))\n","\n","\n","MaskSavePath= CurrentDirectory+'/Mask/'\n","\n","model = UNet(2, height, width)\n","\n","model.load_weights(\"Trained_Model.hdf5\")\n","\n","for imageName,gt in zip(imagePath,GT):\n","    img = cv2.imread(imageName,-1)\n","    imgcopy=img.copy()\n","    filename, file_extension = os.path.splitext(imageName) \n","    \n","    img=cv2.resize(img,(width,height))\n","    img=img.astype(np.float32)\n","    img = img/img.max()\n","    img=np.expand_dims(img, axis=0)\n","    Prediction=model.predict(img,verbose=0)\n","    \n","    mask=Prediction.reshape(height,width)\n","    mask=(255*(mask/mask.max())).astype('uint8')\n","    cv2.imwrite(MaskSavePath+filename[-12:]+'.png',mask)"],"execution_count":0,"outputs":[{"output_type":"stream","text":["200\n","200\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"3NvNMsulPkxf","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]}]}